package com.sky.controller.user;

import com.sky.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 用户端的店铺接口
 * @Author: 林锐涛
 * @Date: 2025/2/1 14:48
 */

@RestController("userShopController")
@Slf4j
@RequestMapping("/user/shop")
public class ShopController {

    public static final String KEY="SHOP_STATUS";

    @Autowired
    RedisTemplate redisTemplate;

    @GetMapping("/status")
    public Result<Integer> getStatus(){
        Integer status = (Integer)redisTemplate.opsForValue().get(KEY);
        log.info("获取店铺营业状态:{}",status==1?"营业":"打烊");
        return Result.success(status);
    }

}
